﻿using System.ComponentModel;

namespace Devonline.Core;

/// <summary>
/// 经纬度
/// </summary>
/// <param name="Longitude">经度</param>
/// <param name="Latitude">纬度</param>
[Description("地理位置经纬度")]
public record LongitudeAndLatitude([Description("经度")] double Longitude, [Description("纬度")] double Latitude)
{
    /// <summary>
    /// 经纬度的标准字符串表示形式
    /// '纬度° N/S, 经度° E/W'
    /// </summary>
    /// <returns></returns>
    public override string ToString()
    {
        var lat = Latitude >= 0 ? "N" : "S";
        var lng = Longitude >= 0 ? "E" : "W";
        return $"{Latitude}° {lat}, {Longitude}° {lng}";
    }
}

/// <summary>
/// 地理位置经纬度标准文本形式
/// </summary>
/// <param name="Longitude">经度</param>
/// <param name="Latitude">纬度</param>
[Description("地理位置经纬度标准文本形式")]
public record GeographicalLocation([Description("经度")] string Longitude, [Description("纬度")] string Latitude);